<?php
/**
 * Created by PhpStorm.
 * User: chniccs
 * Date: 2019-12-12
 * Time: 16:28
 */

namespace app\app\controller;


use app\model\AdminCategory;
use app\util\ReturnCode;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\DbException;

class Category extends Base
{

    public function getList(){
        $where = $this->addTid([]);
        try {
            $result = (new AdminCategory())->where($where)->field('title,id')->select();
            return $this->buildSuccess($result);
        } catch (DataNotFoundException $e) {
        } catch (ModelNotFoundException $e) {
        } catch (DbException $e) {
        }
        return $this->buildFailed(ReturnCode::FAILED,'获取分类失败');
    }
}